package com.aeon.bytecode;

import org.objectweb.asm.ClassWriter;
import static org.objectweb.asm.Opcodes.*;

public class ClassWriterTst {
	/*
	 * public class A { public static int a=7; public void m1(){ } }
	 */

	private void m1() {

		ClassWriter writer = new ClassWriter(0);
		writer.visit(V1_7, ACC_PUBLIC, "com/aeon/A", null, "java/lang/Object",
				null);
		writer.visitField(ACC_FINAL + ACC_PUBLIC + ACC_STATIC, "a", "I", null,
				7).visitEnd();
		writer.visitMethod(ACC_PUBLIC, "m1", "()V", null, null).visitEnd();
		writer.visitEnd();
		class B extends ClassLoader {
			public Class defineclass(byte[] b) {
				return super.defineClass("com.aeon.A", b, 0, b.length);
			}
		}
		Class class1=new B().defineclass(writer.toByteArray());	
System.out.println("");
	}
	
	public static void main(String[] args) {
		new ClassWriterTst().m1();
	}
	
}
